// https://cdnjs.cloudflare.com/ajax/libs/m3u8-parser/4.7.0/m3u8-parser.min.js
// import { Parser } from 'm3u8-parser';

// New Version ===========================================================================
function setVisible(id) {
    id = id.startsWith('.')?id:'.' + id;
    const compent = document.querySelector(id);
    if (!compent) return;
    compent.className = compent.className.replace("hidden", "").trim();
}

function setHidden(id) {
    id = id.startsWith('.')?id:'.' + id;
    const compent = document.querySelector(id);
    if (!compent) return;
    if (compent.className.indexOf("hidden") >= 0) return;
    compent.className = compent.className + " hidden";
}

function disable(id) {
    id = id.startsWith('.')?id:'.' + id;
    const compent = document.querySelector(id);
    if (!compent) return;
    compent.inert = true;
}

function enable(id) {
    id = id.startsWith('.')?id:'.' + id;
    const compent = document.querySelector(id);
    if (!compent) return;
    compent.inert = false;
}

function addDownloadBtn() {
    const userRow = document.querySelector(".video-info-row.userRow");

    const downloadDiv = `
    <div class="${PH_DOWNLOAD_DIV_ID}">
        <button class="${PH_DOWNLOAD_BUTTON_ID}" type="button">
            <i class="fi fi-rr-download ph-icon-download"></i>
            <span class="${PH_BUTTON_LABEL_ID}">Download</span>
        </button>
    </div>
    `;
    userRow.insertAdjacentHTML('beforeend', downloadDiv);

    // add download button click event
    const button = document.querySelector(`.${PH_DOWNLOAD_BUTTON_ID}`);
    button.addEventListener('click', () => {
        // download all m3u8
        getAllM3U8(VIDEO_DEFINITIONS)
        .then(m3u8=>{
            const items = document.querySelectorAll(`.${PH_DOWNLOAD_BARROW_ID} > .${PH_DOWNLOAD_MIDEA_ITEM_ID}`);
            VIDEO_DEFINITIONS.forEach(definition=>registerDownloader(definition, definition.item));
            setVisible(`.${PH_DOWNLOAD_BARROW_ID}`);
        });
    });

    // add download button style
    addDownloadBtnStyle();
    console.log('Download button added');
}

function addDownloadBtnStyle() {
    const cssText = `
        .${PH_DOWNLOAD_DIV_ID} {
            vertical-align: middle;
            position: absolute;
            display: flex;
            top: 13.5px;
            margin-top: auto;
            right: 230px;
        }
        @media only screen and (max-width: 1349px) {
            .${PH_DOWNLOAD_DIV_ID} {
                right: 155px;
            }
        }

        .${PH_DOWNLOAD_BUTTON_ID} {
            font-size: 14px;
            color: #c6c6c6;
            text-align: center;
            border: 1px solid #c6c6c6;
            min-width: 145px;
            padding: 0;
            border-radius: 3px;
            -moz-border-radius: 3px;
            -webkit-border-radius: 3px;
            -ms-border-radius: 3px;
            -o-border-radius: 3px;
            background-color: transparent;
            font-style: normal;
            font-weight: 700;
            line-height: 42px;
            box-sizing: border-box;
            cursor: pointer;
            float: left;
            vertical-align: middle;
            margin-left: 0;
            margin-right: 0;
        }
        .${PH_DOWNLOAD_BUTTON_ID}:hover {
            border: 1px solid #ff9900;
        }

        .${PH_DOWNLOAD_BUTTON_ID} i {
            font-size: 20px;
            width: auto;
            height: auto;
            margin-right: 0;
            background: 0 0;
            margin-bottom: 5px;
            vertical-align: middle;
        }
        .${PH_DOWNLOAD_BUTTON_ID} span {
            line-height: normal;
            margin-left: 4px;
        }
        
    `;
    const styleSheet = document.createElement('style');
    styleSheet.appendChild(document.createTextNode(cssText));
    document.head.appendChild(styleSheet);
}

function addProgressBarRow() {
    addAllMideaDownloadItems();
    addCommonBarRowStyle();
    console.log('Bar row added');
}

function addCommonBarRowStyle() {
    const cssText = `
        .${PH_DOWNLOAD_BARROW_ID} {
            position: relative;
            width: 100%;
            box-sizing: border-box;
            margin-top: 9px;
            border: 1px solid #1b1b1b;
            border-radius: 3px;
            cursor: default;
        }

        .${PH_DOWNLOAD_MIDEA_ITEM_ID} {
            margin: 6px;
        }

        .${PH_DOWNLOAD_MEDIA_BTN_ID} {
            border-radius: 8px;
            -moz-border-radius: 8px;
            -webkit-border-radius: 8px;
            -ms-border-radius: 8px;
            -o-border-radius: 8px;
            /*padding: 8px 18px;*/
            background: #1b1b1b;
            font-weight: 800;
            font-size: 15px;
            color: #fff;
            text-transform: capitalize;
            white-space: nowrap;
            border: 0;
            width: 100%;
            height: 32px;
            cursor: pointer;
        }
        .${PH_DOWNLOAD_MEDIA_BTN_ID}:hover {
            background: #2f2f2f;
        }

        .${PH_PROGRESS_BAR_DIV_ID} {
            display: flex;
            height: 32px;
            line-height: 20px;
            text-align: center;
            position: relative;
            box-sizing: border-box;
            width: 100%;
        }
        
        .${PH_PROGRESS_BAR_LABEL_ID} {
            float: left;
            width: 60px;
            position: relative;
            display: flex;
            flex-shrink: 0;
            line-height: 32px;
            justify-content: center;
            background-color: #1b1b1b;
            color: #fff;
            border-radius: 3px;
            box-sizing: border-box;
            font-size: 16px;
            font-weight: 700;
        }

        .${PH_PROGRESS_BAR_ID} {
            position: relative;
            background-color: #6d6d6d;
            float: left;
            display: flex;
            flex: 1 1 0;
            margin-left: 10px;
            width: 70%;
            box-sizing: border-box;
            border-radius: 3px;
        }
        .${PH_PROGRESS_BAR_ID} span {
            background-color: #4f86e2;
            height: 100%;
            width: 0%;
            display: block;
            border-radius: 3px;
        }
        
        .${PH_PROGRESS_BAR_DIV_ID} i {
            flex-shrink: 0;
            font-size: 20px;
            line-height: 32px;
            padding: 0 5px 0 5px;
            margin-left: 10px;
            border-radius: 8px;
            -moz-border-radius: 8px;
            -webkit-border-radius: 8px;
            -ms-border-radius: 8px;
            -o-border-radius: 8px;
            background: #1b1b1b;
            font-weight: 400;
            text-transform: capitalize;
            white-space: nowrap;
        }
        .${PH_PROGRESS_BAR_DIV_ID} i:hover {
            background: #2f2f2f;
        }

        /* other button icon */
        .${PH_PROGRESS_BAR_DIV_ID} i.fi {
            line-height: 35px;
            color: #b2b2b2;
        }
        .${PH_PROGRESS_BAR_DIV_ID} i.fi:hover {
            color: #4f86e2;
        }
            
        /* cancel button icon */
        .${PH_PROGRESS_BAR_DIV_ID} i.ph-icon-cross {
            color: #7e2424;
        }
        .${PH_PROGRESS_BAR_DIV_ID} i.ph-icon-cross:hover {
            color: #e71717;
        }
    `;
    const styleSheet = document.createElement('style');
    styleSheet.appendChild(document.createTextNode(cssText));
    document.head.appendChild(styleSheet);
}

function addAllMideaDownloadItems() {
    let html = `
        <div class="${PH_DOWNLOAD_BARROW_ID} hidden">
    `;
    // {240,480,720,1080,...}
    let resolutions = VIDEO_DEFINITIONS.map(item=>item.height);
    for(const resolution of resolutions) {
        html += `
            <div class="${PH_DOWNLOAD_MIDEA_ITEM_ID} resolution-${resolution}" data-resolution="${resolution}">
                <button class="${PH_DOWNLOAD_MEDIA_BTN_ID}">
                ${resolution}P
                </button>
                <div class="${PH_PROGRESS_BAR_DIV_ID} hidden">
                    <span class="${PH_PROGRESS_BAR_LABEL_ID}">${resolution}P</span>
                    <span class="${PH_PROGRESS_BAR_ID}">
                        <span></span>
                    </span>
                    <i class="fi fi-sr-play ph-icon-fi"></i>
                    <i class="fi fi-sr-pause ph-icon-fi"></i>
                    <!-- pornhub cross icon -->
                    <i class="ph-icon-cross"></i>
                </div>
            </div>
        `;
    }
    html += `</div>`;

    const userRow = document.querySelector(`.video-info-row.userRow`);
    userRow.insertAdjacentHTML('beforeend', html);

    // 添加事件监听
    const items = document.querySelectorAll(`.${PH_DOWNLOAD_BARROW_ID} > .${PH_DOWNLOAD_MIDEA_ITEM_ID}`);
    for (const item of items) {
        const resolution = item.getAttribute("data-resolution");
        const definition = getVideoDefinitionByHeight(resolution);
        const btn = item.children[0];
        const bar = item.children[1];
        const playIcon = bar.children[2];
        const pauseIcon = bar.children[3];
        const cancelIcon = bar.children[4];
        definition.item = item;
        definition.playIcon = playIcon;
        definition.pauseIcon = pauseIcon;
        definition.cancelIcon = cancelIcon;
        btn.addEventListener("click", function () {
            const item_id = getFullClassName(item);
            const btn_id = `${item_id} > ${getFullClassName(btn)}`;
            const bar_id = `${item_id} > ${getFullClassName(bar)}`;
            console.log("resolution", resolution);
            definition.components.downloader.run();
            setHidden(btn_id);
            setVisible(bar_id);
        });
        playIcon.addEventListener("click", function () {
            const item_id = getFullClassName(item);
            const bar_id = `${item_id} > ${getFullClassName(bar)}`;
            definition.components.downloader.run();
            definition.components.bar.resume();
            disable(`${bar_id} > ${getFullClassName(playIcon)}`);
            enable(`${bar_id} > ${getFullClassName(pauseIcon)}`);
        });
        pauseIcon.addEventListener("click", function () {
            const item_id = getFullClassName(item);
            const bar_id = `${item_id} > ${getFullClassName(bar)}`;
            definition.components.downloader.pause();
            definition.components.bar.pause();
            enable(`${bar_id} > ${getFullClassName(playIcon)}`);
            disable(`${bar_id} > ${getFullClassName(pauseIcon)}`);
        })
        cancelIcon.addEventListener("click", function () {
            const item_id = getFullClassName(item);
            const btn_id = `${item_id} > ${getFullClassName(btn)}`;
            const bar_id = `${item_id} > ${getFullClassName(bar)}`;
            definition.components.downloader.cancel();
            setVisible(btn_id);
            setHidden(bar_id);
        });

        // @todo register golabal definition

    }

    console.log('all midea items added');
}

// ======================================================================================

function getVideoDefinitionByHeight(height) {
    /**
     * Get the video definition by height
     * @param {number} height
     * @return {string}
     */
    return VIDEO_DEFINITIONS.find(definition=>definition.height == height);
}

function getFullClassName(element) {
    /**
     * Get the full class name of an element
     * @param {HTMLElement} element
     * @returns {string}
     */
    return '.' + Array.from(element.classList).join('.');
}

function httpGetText(url) {
    // return new Promise((resolve, reject) => {
    //     fetch(url, {method: 'GET'})
    //     .then(resp=>{
    //         if(!resp.ok) {
    //             console.log('[httpGet] Download failed. url: ', url, '\nresp: ', resp);
    //             return Promise.reject('fail to download');
    //         }
    //         resolve(resp);
    //     }).catch(err=>{
    //         console.log('[httpGet] Download failed. url: ', url, '\nError: ', e);
    //         reject(err);
    //     });
    // });
    return new Promise((resolve, reject) => { 
        GM.xmlHttpRequest({
            method: 'GET', 
            url: url,
            responseType: 'text',
            headers: {
                'accept': '*/*',
                'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
                'priority': 'u=1, i',
                'sec-ch-ua': '"Chromium";v="136", "Microsoft Edge";v="136", "Not.A/Brand";v="99"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"Windows"',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'cross-site',
                'Referer': 'https://www.pornhub.com/',
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0',
            },
            anonymous: true,
        }).then(resp=>{
            if(resp.readyState == 4 && resp.status==200){ 
                resolve(resp.responseText);
                return;
            }
            reject(resp);
        }).catch(e=>reject(e));
    });
}

function httpGetArraybuffer(url) {
    return new Promise((resolve, reject) => { 
        GM.xmlHttpRequest({
            method: 'GET', 
            url: url,
            responseType: 'arraybuffer',
            headers: {
                'accept': '*/*',
                'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
                'priority': 'u=1, i',
                'sec-ch-ua': '"Chromium";v="136", "Microsoft Edge";v="136", "Not.A/Brand";v="99"',
                'sec-ch-ua-mobile': '?0',
                'sec-ch-ua-platform': '"Windows"',
                'sec-fetch-dest': 'empty',
                'sec-fetch-mode': 'cors',
                'sec-fetch-site': 'cross-site',
                'Referer': 'https://www.pornhub.com/',
                'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0',
            },
            anonymous: true,
        }).then(resp=>{
            // console.log('[httpGet] Download success. url: ', url, '\nresp:', resp);
            console.log('[segment] Download success');
            resolve(resp.response);
        }).catch(e=>{
            console.log('[httpGet] Download failed. url: ', url, '\nError: ', e);
            reject(e);
        });
    });
}

function registerDownloader(definition, item) {
    /**
     * Add item and some methods to control it to the definition
     * @param {object} definition
     * @param {HTMLElement} item
     * @returns {void}
     */
    const COLOR_RUN = "#4f86e2", COLOR_PAUSE = "#c27c27", COLOR_FAIL = "#e71717", COLOR_COMPLETE = "#2bca1c";

    let position = 0;
    const barSpan = item.children[1].children[1].children[0];
    const bar = {
        element: item,
        initialize: function() { 
            position = 0;
            barSpan.style.width = '0%';
            barSpan.style.backgroundColor = COLOR_RUN;
        },
        update: function () {
            position ++;
            let progressMax = definition.m3u8Datas.indexM3u8.length;
            let progressPercent = (position / progressMax) * 100;
            
            barSpan.style.width = `${progressPercent}%`;
            barSpan.style.backgroundColor = COLOR_RUN;

            if (position >= progressMax) {
                bar.completed();
            }
        },
        resume: function() {
            barSpan.style.backgroundColor = COLOR_RUN;
        },
        pause: function() {
            barSpan.style.backgroundColor = COLOR_PAUSE;
        },
        failed: function() {
            barSpan.style.backgroundColor = COLOR_FAIL;
            // @todo pause-icon change to inert equal true
        },
        completed: function() {
            position = definition.m3u8Datas.indexM3u8.length;
            barSpan.style.width = '100%';
            barSpan.style.backgroundColor = COLOR_COMPLETE;
        },
    };

    const urls = definition.m3u8Datas.indexM3u8.map(d=>d.uri);
    let nums = 3;
    const complete = function(allSegmengts) {
        bar.completed();
        Promise.all(allSegmengts)
        .then(segmentDatas=>{
            console.log('Successful all ts chunks downloaded');
            let suffix = definition.videoUrl.split('/')[8];
            const videoBlob =  new Blob(segmentDatas, {type:'video/mp4'});
            const downloadLink = document.createElement('a');
            downloadLink.href = URL.createObjectURL(videoBlob);
            downloadLink.download = "[" + VIDEO_UPLOADER + "] " + VIDEO_TITLE + "." + suffix;
            downloadLink.click();
        });
    };
    const downloader = concurrentDownload_v2(urls, nums, bar.update, bar.failed, complete);

    definition.components = { bar, downloader };
    console.log('register bar and downloader');
}

function concurrentDownload_v2(urls, nums, then, fail, complete) {
    /**
     * @param {string[]} urls url list
     * @param {number} nums concurrent download nums
     * @param {function} then each url success callback
     * @param {function} fail fail callback
     * @param {function} complete all url complete callback, supplied with the downloaded data
     */
    const data = {
        urls: urls,
        indices: Array.from(urls, (_,i)=>i),
        position: -1,
        isCancel: false,
        isPause: false,
        nums: nums,
        limit: 0,   // promises limit
        promises: [],
        segmengDatas: [],
    };

    const next = function() {
        data.position++;
        let seq = data.indices[data.position]; // index of data.urls
        return {seq: seq, url: data.urls[seq]};
    };
    const hasNext = function() {
        return !(data.position == data.indices.length);
    };
    const result = function(seq, segment) {
        data.segmengDatas[seq] = segment;
    };
    const download = function() {
        if (!hasNext()) {
            console.log("no more, waiting other threads");
            return Promise.resolve({seq: -1, segment: undefined});
        }
        let {seq, url} = next();
        return httpGetArraybuffer(url)
            .then(segment => {
                // successfully fetch
                if (seq > 15){
                    console.log("manual throw: " + seq);
                    throw new Error("> 15");
                }
                return {seq, segment};
            }).catch(err=>{
                console.log('failure url: ', url, 'err: ', err);
                pause(); // pause all promises
                fail();
                data.indices.push(seq); // 失败的数据添加到队尾，后续再重新下载
                return {seq: -1, segment: undefined};
            });
    }
    const run = async function() { 
        data.isPause = false;
        while (true) {
            // Increased the number of parallels
            if (data.limit < data.nums) {
                for (let i = data.limit; i < data.nums; i++) { 
                    if (i < data.promises.length) 
                        data.promises[i] = download().then(resp=>[i, resp]);
                    else
                        data.promises.push(download().then(resp=>[i, resp]));
                }
                data.limit = data.nums;
            }
            const [i, {seq, segment}] = await Promise.any(data.promises);

            if (data.isPause) 
                return;
            if (data.isCancel) {
                data.promises = undefined;
                data.segmengDatas = undefined;
                return;
            }
            if (seq != -1){
                result(seq, segment);
                then();
            }
            
            // finish
            if (!hasNext()) {
                console.log('all url generate complete, waiting for all download complete');
                await Promise.all(data.promises);
                // other promises may be fails
                if(!hasNext()) {
                    break;
                }
            }

            // Reduced the number of parallels
            if (i < data.nums) {
                data.promises[i] = download().then(resp=>[i, resp]);
            }
        }
        // all done
        complete(data.segmengDatas);
    };
    const pause = function() { 
        data.isPause = true;
    };
    const cancel = function() { 
        data.isRunning = true;
    };

    return {run, pause, cancel};
}

function parseMasterM3U8(text) { 
    /**
     * mater.m3u8 response parse
     */
    const parse = new m3u8Parser.Parser();
    parse.push(text);
    parse.end();
    return parse.manifest.playlists;
}

function parseIndexM3U8(text) { 
    /**
     * index.m3u8 response parse
     */
    const parse = new m3u8Parser.Parser();
    parse.push(text);
    parse.end();
    return parse.manifest.segments;
}

function estimate_size_by_bitrate(bitrate_bps, duration_seconds){
    /**
     * 根据码率和时长估算文件大小
     * bitrate_bps: 码率（bits per second）
     * duration_seconds: 视频时长（秒）
     */
    // 从master.m3u8可以看到BANDWIDTH
    const units = ["B", "KB", "MB", "GB", "TB"];
    let sizeBytes = Math.ceil(bitrate_bps * duration_seconds / 8);
    let i = Math.floor(Math.log2(sizeBytes) / Math.log2(1024));
    let human_size = Math.ceil(sizeBytes / Math.pow(1024, i)) + units[i];
    return { size: sizeBytes, human_size: human_size };
}

function downloadM3U8(masterM3u8Url) {
    /**
     * m3u8Url: master.m3u8 url. 
     *          The content is the link to index.m3u8.
     *          index.m3u8 contains all seg url.
     * 
     * 一个 master.m3u8 的响应结果只有一个 index.m3u8 下载链接
     * 解析 m3u8Url 的响应结果获取index.m3u8的url
     * 解析 index.m3u8 的响应结果获取所有seg的url
     */
    let id = Math.floor(Math.random() * 100);
    let m3u8Datas = {};
    // console.log('task id:', id, 'started.\n',masterM3u8Url);

    // Obtain the public prefix part of master.m3u8, which will be used in index.m3u8.
    // It is also used for all seg urls.
    let position = masterM3u8Url.lastIndexOf('/') + 1;
    const publicPrefix = masterM3u8Url.substring(0, position);
    // console.log(id,'public prefix', publicPrefix);

    // download master.m3u8
    const master = httpGetText(masterM3u8Url)
    .then(m3u8Content => {
        // 一个master.m3u8只有有一个index.m3u8的链接
        m3u8Content = parseMasterM3U8(m3u8Content)[0];
        m3u8Content.uri = publicPrefix + m3u8Content.uri;
        // console.log(id,'mater.m3u8 download successfully.',masterM3u8Url);
        return m3u8Content;
    }).catch((err)=>{
        console.log(id,'Download master.m3u8 failed.\nError: ', err);
        return Promise.reject('fail to download m3u8');
    });
    
    // download index.m3u8
    const promise = master.then(masterM3u8=>{
        // debugger;
        // console.log(id,'index.m3u8 started.', masterM3u8.uri);
        const resp = httpGetText(masterM3u8.uri);
        return Promise.all([masterM3u8, resp]);
    }).then(datas=>{
        // console.log(id,'index.m3u8 download successfully.');
        let [masterM3u8, m3u8Content] = datas;
        let indexM3u8 = parseIndexM3U8(m3u8Content);
        indexM3u8.forEach(item=>item.uri = publicPrefix + item.uri);
        let totalDuration = indexM3u8.reduce((acc, item)=> acc + item.duration, 0);
        let size = estimate_size_by_bitrate(masterM3u8.attributes.BANDWIDTH, totalDuration);
        Object.assign(m3u8Datas, { masterM3u8, indexM3u8, size });
        return m3u8Datas;
    }).catch((err)=>{
        console.log(id,'Download index.m3u8 failed.\nError: ', err);
        return Promise.reject('fail to download m3u8');
    });

    return { m3u8Datas, promise };
}

function getAllM3U8(videoDefinitions) {
    videoDefinitions.forEach(d => {
        let { m3u8Datas, promise } = downloadM3U8(d.videoUrl);
        d.m3u8Datas = m3u8Datas;
        d.m3u8Promise = promise;
    });
    return Promise.all(videoDefinitions.map((def) => def.m3u8Promise))
    .then((datas) => {
        console.log('M3U8 all done.', datas);
        videoDefinitions.forEach(d=>delete d.m3u8Promise);
        return videoDefinitions.map(d=>d.m3u8Datas);
    });
}

function getMediaDefinitions() {
    const video_player_div = document.querySelector('#player');
    if (!video_player_div) {
        console.log('No video player div found');
        return false;
    }
    var video_id = video_player_div.getAttribute('data-video-id');
    
    // the video information is in the var variable flashvars_videoId
    const video_information = this.window['flashvars_' + video_id];
    // VIDEO_DEFINITIONS is array, each element is a link to obtain different resolutions of the video.
    let valid_mediaDefinitions = video_information.mediaDefinitions
        .filter((item) => item.videoUrl.indexOf('master.m3u8')>=0);
    VIDEO_DEFINITIONS.push(...valid_mediaDefinitions.map(item=> ({...item})));
    VIDEO_DEFINITIONS = VIDEO_DEFINITIONS.sort((a,b) => b.height - a.height);
    console.log('VIDEO_DEFINITIONS','flashvars_' + video_id);
    
    // 获取标题、上传者
    VIDEO_TITLE = document.querySelector(".title-container > .title > .inlineFree").innerText;
    VIDEO_UPLOADER = document.querySelector('.userInfo > .usernameWrap > .usernameBadgesWrapper > a').innerText;

    // 挂载到window，方便控制台获取
    this.window['VIDEO_DEFINITIONS'] = VIDEO_DEFINITIONS;
    console.log('title:', VIDEO_TITLE, 'uploader:', VIDEO_UPLOADER);
    return true;
}

// download button
const PH_DOWNLOAD_DIV_ID = 'ph-video-download-div';
const PH_DOWNLOAD_BUTTON_ID = 'ph-video-download-button';
const PH_DOWNLOAD_DROPDOWN_BOX_ID = 'ph-video-download-dropdown-box';
const PH_BUTTON_LABEL_ID = 'ph-button-label';

// progress bar
const PH_DOWNLOAD_BARROW_ID = 'ph-download-barRow';
const PH_DOWNLOAD_MIDEA_ITEM_ID = 'ph-video-download-item';
const PH_DOWNLOAD_MEDIA_BTN_ID = 'ph-video-download-btn';
const PH_PROGRESS_BAR_DIV_ID = 'ph-progress-bar-div';
const PH_PROGRESS_BAR_LABEL_ID = 'ph-progress-bar-label';
const PH_PROGRESS_BAR_ID = 'ph-progress-bar';

var VIDEO_DEFINITIONS = [];
var VIDEO_TITLE = undefined;
var VIDEO_UPLOADER = undefined;
var DOWNLOAD_HOLDER = [];


function main() {
    if ( !getMediaDefinitions() ) {
        return;
    }

    addDownloadBtn(VIDEO_DEFINITIONS);
    addProgressBarRow(VIDEO_DEFINITIONS);
}


document.addEventListener('DOMContentLoaded', function() {
    // DOM完全加载后执行
    console.log('ph-downloader loding...');
    const mp = new m3u8Parser.Parser();
    mp.push(`
        #EXTM3U
        #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2095191,RESOLUTION=1280x720,FRAME-RATE=30.000,CODECS="avc1.64001f,mp4a.40.2"
        index-v1-a1.m3u8?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D

        `);
    const ip = new m3u8Parser.Parser();
    ip.push(`#EXTM3U
        #EXT-X-TARGETDURATION:7
        #EXT-X-ALLOW-CACHE:YES
        #EXT-X-PLAYLIST-TYPE:VOD
        #EXT-X-VERSION:3
        #EXT-X-MEDIA-SEQUENCE:1
        #EXTINF:3.000,
        seg-1-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-2-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-3-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-4-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-5-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-6-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-7-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:4.400,
        seg-8-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-9-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-10-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-11-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-12-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-13-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-14-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-15-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-16-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-17-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-18-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-19-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-20-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-21-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-22-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-23-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-24-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-25-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-26-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-27-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-28-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-29-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-30-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-31-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-32-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-33-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-34-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-35-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-36-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-37-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-38-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-39-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-40-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-41-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-42-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-43-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-44-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-45-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-46-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-47-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-48-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-49-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-50-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-51-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-52-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-53-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-54-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-55-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-56-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-57-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-58-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-59-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-60-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-61-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-62-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-63-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-64-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-65-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-66-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-67-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.667,
        seg-68-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-69-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-70-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-71-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-72-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-73-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-74-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-75-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-76-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-77-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-78-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-79-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-80-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-81-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-82-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-83-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-84-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-85-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-86-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-87-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-88-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-89-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-90-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.100,
        seg-91-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-92-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-93-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-94-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-95-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-96-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-97-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.667,
        seg-98-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-99-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-100-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-101-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-102-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-103-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-104-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-105-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.067,
        seg-106-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-107-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-108-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-109-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-110-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-111-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-112-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-113-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-114-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-115-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-116-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-117-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-118-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-119-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-120-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-121-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-122-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-123-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-124-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-125-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-126-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-127-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-128-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-129-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-130-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-131-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-132-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-133-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-134-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-135-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-136-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-137-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-138-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-139-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-140-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-141-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-142-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-143-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-144-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-145-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-146-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-147-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-148-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-149-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-150-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-151-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-152-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-153-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-154-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-155-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-156-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-157-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-158-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-159-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-160-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-161-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-162-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-163-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-164-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-165-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-166-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-167-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-168-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-169-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-170-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-171-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-172-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-173-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-174-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-175-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-176-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-177-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-178-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-179-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-180-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-181-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-182-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-183-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-184-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-185-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-186-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-187-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-188-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-189-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-190-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-191-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-192-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-193-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-194-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-195-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-196-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-197-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-198-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-199-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-200-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-201-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-202-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-203-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-204-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-205-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-206-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-207-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-208-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-209-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-210-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-211-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-212-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-213-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-214-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-215-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-216-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-217-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-218-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-219-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-220-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-221-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-222-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-223-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-224-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.900,
        seg-225-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-226-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-227-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-228-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-229-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-230-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-231-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:2.900,
        seg-232-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-233-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-234-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-235-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-236-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-237-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-238-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-239-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:5.667,
        seg-240-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-241-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-242-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-243-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-244-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-245-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-246-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-247-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.033,
        seg-248-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.000,
        seg-249-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:3.000,
        seg-250-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXTINF:6.833,
        seg-251-v1-a1.ts?validfrom=1752311689&validto=1752318889&ipa=205.198.88.118&hdl=-1&hash=w4ZmBTCCN6EB9XvogySNFDp5QHs%3D
        #EXT-X-ENDLIST
        `);
    console.log('mp -> ', mp);
    console.log('ip -> ', ip);
    
    
    main();
});